package com.wfy.mapper;

import com.wfy.pojo.Brand;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

/**
 * @Title: BrandMapper
 * @Package com.wfy.mapper
 * @Author 王飞遥
 * @Date 2022/8/17 20:23
 */
public interface BrandMapper  extends Mapper<Brand> {
    @Insert("insert into tb_category_brand(category_id, brand_id) VALUE (#{cid},#{bid})")
    int insertCategoryAndBrand(Long cid, Long bid);
    @Select("select t2.* from tb_category_brand t1 inner join tb_brand t2 on t1.brand_id = t2.id " +
            "where  t1.category_id = #{cid}")
    List<Brand> queryBrandByCid(Long cid);//三级id查询商品
}
